package com.it.xx.demo;

import com.it.xx.domian.Manager;

import java.io.*;
import java.util.ArrayList;

public class Test2 {
    public static void main(String[] args) throws IOException {
        Manager manager1 = new Manager(10001, "小王", "男", "13112345678");
        Manager manager2 = new Manager(10002, "老于", "男", "13212345678");
        Manager manager3 = new Manager(10003, "老方", "男", "13312345678");
        BufferedWriter bw = new BufferedWriter(new FileWriter("exercise\\managers.txt"));
        BufferedReader br = new BufferedReader(new FileReader("exercise\\managers.txt"));
        ArrayList<Manager> mlist = new ArrayList<>();
        mlist.add(manager1);
        mlist.add(manager2);
        mlist.add(manager3);
        for (Manager manager : mlist) {
            bw.write(manager.getAid() + "," + manager.getName() + "," + manager.getGender() + "," + manager.getPhone());
            bw.newLine();
        }
        bw.close();
        String s;
        while ((s = br.readLine()) != null) {
            System.out.println(s);
        }

        br.close();
    }
}
